package com.myimooc.shiro.web.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @className: DataSourceConfig
 * @description: 数据源配置
 * @date: 2020/5/12
 * @author: cakin
 */
@Configuration
public class DataSourceConfig {

    /**
     * 功能描述：配置MyBatis的数据源
     *
     * @return DruidDataSource
     * @author cakin
     * @date 2020/5/12
     */
    @Bean
    public DruidDataSource dataSource() {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mysql://localhost:3306/shiro?useUnicode=true&characterEncoding=utf8&useSSL=false");
        dataSource.setUsername("root");
        dataSource.setPassword("123456");
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        return dataSource;
    }
}
